/** @method useDataType
 *  @description 获取数据类型的数据
 *  @return Array
 */
import { useEffect, useState } from 'react';
import services from '../services/api';

export default function useDataType() {
  const [dataType, setDataType] = useState([]);

  useEffect(() => {
    services.dataType.list().then(({ code, data }) => {
      if (code === '0') {
        setDataType(data);
      }
    });
  }, []);

  return dataType;
}
